import common from "./common";

export default {

    addCommands() {
        Cypress.Commands.add("treeSelect",
            {
                prevSubject: 'optional'
            },
            (subject: Cypress.Chainable<any>, label: string): Cypress.Chainable<any> => {
                return common.selectNode(subject, "button:contains('" + label + "')").click();
            });

        Cypress.Commands.add("treeExpand",
            {
                prevSubject: 'optional'
            },
            (subject: Cypress.Chainable<any>, label: string): Cypress.Chainable<any> => {
                return common.selectNode(subject, "button[aria-label='toggle " + label + "']").click();
            });
    }

}
